package ru.spb.nicetu.schoolproject.data;

import javax.persistence.*;

/**
 * Created by dchernyshov on 25.04.15.
 */
@Entity
@NamedNativeQueries( {
        @NamedNativeQuery(name = "Lesson.byClassDayNum", query = "select * from school_schema.timetable" +
        " where class = ? and day = ? and lessonNum = ?", resultClass = Lesson.class),
        @NamedNativeQuery(name = "Lesson.byClassDay", query = "select * from school_schema.timetable" +
        " where class = ? and day = ?", resultClass = Lesson.class)})
@Table (name = "school_schema.timetable")
public class Lesson {
    @Id @GeneratedValue (strategy = GenerationType.SEQUENCE)
    @Column (name = "id")
    private int lessonId;
    @ManyToOne
    @JoinColumn (name = "class")
    private SchoolClass clazz;
    @ManyToOne
    @JoinColumn (name = "subject")
    private Subject subject;
    @ManyToOne
    @JoinColumn (name = "teacher")
    private Teacher teacher;
    @Column (name = "lessonNum")
    private int lessonNum;
    @ManyToOne
    @JoinColumn (name = "day")
    private DayOfWeek dayOfWeek;

    public int getLessonId() {
        return lessonId;
    }

    public void setLessonId(int lessonId) {
        this.lessonId = lessonId;
    }

    public SchoolClass getClazz() {
        return clazz;
    }

    public void setClazz(SchoolClass clazz) {
        this.clazz = clazz;
    }

    public Subject getSubject() {
        return subject;
    }

    public void setSubject(Subject subject) {
        this.subject = subject;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    public int getLessonNum() {
        return lessonNum;
    }

    public void setLessonNum(int lessonNum) {
        this.lessonNum = lessonNum;
    }

    public DayOfWeek getDayOfWeek() {
        return dayOfWeek;
    }

    public void setDayOfWeek(DayOfWeek dayOfWeek) {
        this.dayOfWeek = dayOfWeek;
    }
}
